{% extends "howto" %}

{% block main %}
<h2 id="storages">Storages</h2>

<p><em>Storages</em> are specialized Tools.
They retrievent and build object instances from files of the kit.</p>

<p>Just as standard Tools, you get them as members of their parent kit.
As an example, let's get a template object from the <em>templates</em> storage of a  kit :</p>

<code>// defining search criteria
<var>$criteria</var>=array('id'=>'help','lang'=>'fr');

// gettign templates instance
<var>$tpl</var>=<var>$kit</var>->templates->getItem($criteria);

// using template
echo <var>$tpl</var>->render($data);</code>

<h3>How it works</h3>

<p>A search pattern is defined in the tool's configuration file.
It's a relative path (from the kit's root) which elements between double accolads will be içnterpreted as variables. A an exemple :</p>
<code>[storage]
<var>search</var> = "templates/&#123;{lang}}/&#123;{id}}.html"</code>
<p>Here if <var>lang</var>="en" and <var>id</var>="help" the template's source file will be <q>templates/fr/help.html</q>.</p>
{% endblock %}
